Skip to content

Refactor/wasow galerkin engine#249

Draft
matt-pharr wants to merge 5 commits into
developfrom
refactor/wasow-galerkin-engine
Draft

Refactor/wasow galerkin engine#249
matt-pharr wants to merge 5 commits into
developfrom
refactor/wasow-galerkin-engine

Conversation

@matt-pharr
Copy link
Copy Markdown
Collaborator

This is a refactor of the galerkin solver that abstracts it so it could hypothetically be used for other inner layer models, were physics to be added to GGJ.

matt-pharr and others added 5 commits May 22, 2026 14:22
…hared WasowGalerkin engine

Extract the singular-Galerkin Hermite FEM and Wasow asymptotic-basis kernel from
the GGJ-specific InnerAsymptotics.jl/Galerkin.jl into a model-agnostic engine, so
other toroidal inner-layer models (e.g. a future two-fluid layer) can reuse it.
GGJ becomes the first client and regression oracle.

- Add the WasowGalerkin engine: SystemSpec.jl (model-agnostic seam),
  Asymptotics.jl (generalized Wasow construction: block-Sylvester split, general
  Vandermonde, nterms-length recurrence, sizes as values), Galerkin.jl (FEM
  generic over ncomp), ParityBC.jl, FullDomain.jl, WasowGalerkin.jl.
- Build the GGJ SystemSpec in GGJ/GGJSpec.jl and dispatch solve_inner to the
  engine; delete GGJ/InnerAsymptotics.jl and GGJ/Galerkin.jl (logic moved);
  keep backward-compatible build_asymptotics/evaluate_asymptotics/pick_xmax.
- Extend InnerLayerInterface for the full-domain return path.
- Reproduce the glasser_wang_2020_eq55 golden within the solver's xmax-bisection
  reproducibility floor (ggj_reference.toml thresholds widened and documented).
- Add test/runtests_innerlayer.jl (wired into runtests.jl) and docs autodocs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ve via reflect-and-merge

Implement and validate the WasowGalerkin full-domain (parity-coupled) path,
replacing the earlier buggy scaffolding. The left half is assembled in the
reflected coordinate s=-x (a standard right-oriented half-domain, operator
I u_ss - V u_s + U u at x=-s, asymptotics continued by per-component parity) and
merged with the right half at the shared center node x=0 (value DOFs identified,
derivative DOFs sign-flipped; the two x=0 IBP surface terms cancel). This reuses
the validated half-domain assembly on each side and fixes all three full-domain
bugs, including left ext-cell DOF aliasing.

- Add SystemSpec.component_parity (sigma_c, derived from bc: NEUMANN->+1,
  DIRICHLET->-1; GGJ (+1,-1,-1)); replace the uniform sign-flip in _eval_physical.
- FullDomainMatching now holds the general 2x2 end-matching matrix M; add
  parity_recombine for the symmetric/antisymmetric projection.
- For GGJ M is symmetric (rel asym ~1e-10) and recombines to the half-domain
  (Delta_odd, Delta_even) to ~2e-7 at gamma=1+1i and 0.5+0.3i. M is the general
  deliverable (asymmetric by design for a parity-broken two-fluid layer).
- Half-domain path unchanged bit-for-bit (verified); ggj_reference regression OK.
- test/runtests_innerlayer.jl: full-domain recombination + parity-broken cases
  (44/44).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…gle full-domain solve

- Precompute the x-independent Horner-coefficient packings (cc, dd) and
  fractional-power exponents (rvec = -R/2) once in build_wasow and store them in
  WasowCache, instead of rebuilding them on every evaluate_wasow call. Cuts
  evaluate_wasow allocations from 8960 to 6336 bytes/call (~29%); solve_inner
  drops from 21.0 to 19.4 MB. Output bit-for-bit unchanged (verified).
- solve_galerkin_full: factorize once and solve both driving columns together
  (lu(A) \ rhs) instead of two separate solves.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@matt-pharr matt-pharr marked this pull request as draft May 28, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant